#ifndef __iPARK_CLA_H__
#define __iPARK_CLA_H__
#include "My_Def.h"


typedef struct  {
				  _iq  d;		    	// Input : d 
				  _iq  q;	    		// Input : q
				  _iq  sin;			// Input : sin(theta)
				  _iq  cos;			// Input : cos(theta)
				  _iq  alpha;			// Output  : alpha
				  _iq  beta;		    // Output  : beta
				}IPARK;
				
				/*-----------------------------------------------------------------------------
				Default initalizer for the IPARK object.
				-----------------------------------------------------------------------------*/
#define IPARK_DEFAULTS {   0, \
				           0, \
				           0, \
				           0, \
				           0, \
						   0, \
				          }

#define IPARK_CLA_MACRO(v)														\
	v.alpha =_IQmpy(v.d, v.cos) - _IQmpy(v.q,v.sin);		\
	v.beta  =_IQmpy(v.d, v.sin) + _IQmpy(v.q,v.cos);

#define IPARK_MACRO(v)									\
	v.alpha = v.d * v.cos - v.q*v.sin;		 \
	v.beta  = v.d * v.sin + v.q * v.cos; \
	v.alpha = v.alpha;							 \
	v.beta  = v.beta;
				
				
#define iPARK_CLA_INIT(v)													\
	v.cos=0;																\
	v.sin=0;																\
	v.d=0;																\
	v.q=0;																\
	v.alpha=0;															\
	v.beta=0;															
#endif


